<?php /* Create Group Controller */
	require_once('modules/groups/actions/create/scripts/validate-group.php');
	if (isset($_POST['form-action'])) { //se envio formulario
		$validacion = validarGrupo();
		if (!empty($validacion)) { //fallo validacion
			$arr_students = $group->getStudents();
			$arr_plans = $group->getPlans();
			require_once('modules/groups/actions/create/view/create-group.php');
		} else { //si valido correcto
			$group_id = $group->create();
			$group->addStudentsToGroup($_POST['students'],$group_id);
			$calendar_id = $group->createCalendar($group_id);
			$group->addCalendarToGroup($calendar_id,$group_id);
			//$student->sendEmail();
			require_once('modules/groups/actions/list/index.php');
		}
	} else { //pre-carga
		$arr_students = $group->getStudents();
		$arr_plans = $group->getPlans();
		require_once('modules/groups/actions/create/view/create-group.php');
	}
?>